#include "pthread.hpp"
#include <unordered_map>
#include <memory>
#include <stdlib.h>
typedef std::shared_ptr<bit_thread::Thread> thread_ptr;
#define NUM 10
int main()
{
    std::unordered_map<std::string, thread_ptr> thread_s;
    for (int i = 0; i < NUM; i++)
    {
        thread_ptr t = std::make_shared<bit_thread::Thread>([]()
                                                            {
            while(true)
            {
                std::cout << "hello bit" << std::endl;
                sleep(1);
            } });
        thread_s[t->Name()] = t;
    }
    for (auto &i : thread_s)
    {
        i.second->start();
    }
    for (auto &i : thread_s)
    {
        i.second->stop();
    }
    for (auto &i : thread_s)
    {
        i.second->join();
    }
    return 0;
}